words = '空山新雨后，天气晚来秋。'
result_one = words.find('雨')       # 从整个字符串中查找子串''
print(result_one)
result_two = words.find('雨', 6)    # 从索引6的位置开始查找子串''
print(result_two)
# 遍历字符串，打印每个字符及其对应的索引
for index, char in enumerate(words):
    print(f"字符 '{char}' 的索引是: {index}")

print("-----------------------")

string = '寻寻觅觅，冷冷清清，凄凄惨惨戚戚。'
new_string = string.replace('冷', 'len')        # 不指定替换次数
print(new_string)
new_string = string.replace('清', 'qing', 1)    # 指定替换次数
print(new_string)

